<!DOCTYPE html>
<html lang="zh-CN"><head>
		<title></title>
		<meta charset="utf-8">
		<meta content="" name="description">
		<meta content="" name="keywords">
		<meta content="eric.wu" name="author">
		<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
		<meta content="no-cache,must-revalidate" http-equiv="Cache-Control">
		<meta content="no-cache" http-equiv="pragma">
		<meta content="0" http-equiv="expires">
		<meta content="telephone=no, address=no" name="format-detection">
		<meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
		<link rel="stylesheet" type="text/css" href="commentlist_files/main.css">
		<link rel="stylesheet" type="text/css" href="commentlist_files/dialog.css">
		<script src="commentlist_files/jquery_min.js"></script>
		<script src="commentlist_files/main.js"></script>
		<script src="commentlist_files/dialog_min.js"></script>
		<style>
            .nav_footer>ul a.a_collect.on{
            	color: #ff0000;
            }
            .nav_footer>ul a.on span.icons_love {
            background-position: center -608px;
            }
            
            .list_article>article>section>*{
	            padding-left:10px;
                padding-right:10px;
            }
        </style>
		<script>
			function delComment(thi ,sid, tid, cid, uid, ruid){
				alert('确定删除："'+thi.parentNode.innerText.slice(0, 7)+'..."吗？',null, function(){
					loading(true);
					var req = {
				    	"sid" : sid,
				    	"tid" : tid,
				    	"cid" : cid,
				    	"uid" : uid,
				    	"ruid": ruid
					}
					$.ajax({
						url: "/snsmobile/deletecomment",
						type:"post",
						data:req,
						dataType:"JSON",
						success: function(res){
							loading(false);
							if(1 == res.result){
								$(thi).closest("li").remove();
								location.reload();
							}else{
								alert(res.message||"失败", 1500);
							}
						},
						error: function(){
							loading(false);
							alert("删除失败", 1500);
						}
					});
				}, function(){});
			}


			function userOperate(thi, evt, typ, id){
				var n = -1;
				if(thi.classList.contains("on") ){
					n = 1;
				}
				var obj = {
					userId: 123334,
					type:typ,// collect, like
					n:n
				}
				loading(true);
				$.ajax({
					url: "data/userOperate.json",
					type:"post",
					data:obj,
					dataType:"JSON",
					success: function(res){
						loading(false);
						if(1 == res.result){
							//thi.querySelector("label").innerHTML = res.data.total;
							thi.classList[n>0?"remove":"add"]("on");
						}else{
							alert(res.message||"失败", 1500, function(){});
						}
					}
				});

			}

			function showOperate(type, thi, evt){
				var pop_operate = document.getElementById("pop_operate");
				if(type){
					var btns = thi.innerHTML;
					pop_operate.querySelectorAll("div.pop_container")[0].innerHTML = btns;
					pop_operate.classList.add("on");
				}else{
					pop_operate.classList.remove("on");
				}
			}


			
			function loadMore(sid, tid, uid, page){
				if(page == 1) { page = 2; }
				else page = page+1;
				var req = {
					"sid" : sid,
					"tid" : tid,
					'uid' : uid,
					"page": page,
				}
				loading(true);
				$.ajax({
					url: "/snsmobile/ajaxcomments",
					type:"post",
					data:req,
					dataType:"text",
					success: function(res){
						$('#list_comment').append(res);
						loading(false);
					},
					error:function(){
					    loading(false);
					}
				});

				
			}
	       function collectTrends(type, sid, tid, uid){
		       var args = arguments;
		        loading(true);
	    	    $.post('/snsmobile/collect',{
	    	        "type" : type,
	    	        "sid"  : sid,
	    	        "tid"  : tid,
	    	        "uid"  : uid,
		    	    },function(res){
		    	    	loading(false);
		    	    	if("1" == res){
    		    	    	var $a = $("#collect_001");
    		    	    	var label = $a.find("label")[0];
    		    	    	var total = parseInt(label.innerText );
    		    	    	$("#collect_001, #collect_002")[0==type?"addClass":"removeClass"]("a_collect on");
    		    	    	total = (0 == type)?total+1:total-1;
    		    	    	label.innerText = total;
                            $("#collect_001, #collect_002").attr("onclick", 'collectTrends('+[1,0][type]+","+(Array.prototype.slice.call(args, 1).join(','))+');');
		    	    	}
		    	    });
	        }
	       function praiseTrends(type, sid, tid, uid){
	    	    var args = arguments;
	    	    loading(true);
	    	    $.post('/snsmobile/praise',{
	    	        "type" : type,
	    	        "sid"  : sid,
	    	        "tid"  : tid,
	    	        "uid"  : uid,
		    	    },function(res){
		    	    	loading(false);
		    	    	if("1" == res){
    		    	    	var $a = $("#praise_001");
    		    	    	var label = $a.find("label")[0];
    		    	    	var total = parseInt(label.innerText );
    		    	    	$("#praise_001, #praise_002")[0==type?"addClass":"removeClass"]("on");
    		    	    	total = (0 == type)?total+1:total-1;
    		    	    	label.innerText = total;
                            $("#praise_001, #praise_002").attr("onclick", 'praiseTrends('+[1,0][type]+","+(Array.prototype.slice.call(args, 1).join(','))+');');
		    	    	}
		    	    });
	        }
	        
	       function commentPraise(type,sid,tid,cid,uid) {
	    	    var args = arguments;
	    	    loading(true);
	    	    $.post('/snsmobile/commentpraise',{
		    	    "type" : type,
	    	        "sid"  : sid,
	    	        "tid"  : tid,
	    	        "cid"  : cid,
	    	        "uid"  : uid,
	    	    },function(res){
	    	    	loading(false);
	    	    	if("1" == res){
		    	    	var label = $("#praise_"+cid)[0];
		    	    	var total = parseInt(label.innerText );
		    	    	total = (0 == type)?total+1:total-1;
		    	    	label.innerText = total;
		    	    	$("#cid_"+cid).attr("href", 'javascript:commentPraise('+[1,0][type]+","+(Array.prototype.slice.call(args, 1).join(','))+');')[0].innerText = [ "取消赞", "赞"][type];
	    	    	}
	    	    });	       
	       }
		</script>
	</head>
	<body onselectstart="return true;" ondragstart="return false;" class="discuss_detail">
		<div id="container" class="container">
			<header></header>
			<div class="body pt_5">
				<div id="
				" class="list_article">
					<article>
						<section>
								<h5>我想买台可以p图的电脑，大概五千左右</h5>
								<h6>
									<small>2014-10-26 21:48:18</small>
								</h6>
																<div>美工用的，整体性能稳定，分辩率高些。<img src="commentlist_files/4.gif" data-innerhtml="/:8-)"></div>
						</section>
						<footer>
							<ul class="box">
								<li>
									<a href="javascript:;" class="a_collect"><span class="number"><label>3</label></span>评论</a>
								</li>
								<li>
                                									<a href="javascript:;" class="a_like on" id="praise_001" onclick="praiseTrends(1, 349257, 3533, 387016);"><span class="icons icons_like">&nbsp;</span><label>2</label></a>
																</li>
								<li>
								                                    <a href="javascript:;" class="a_collect" id="collect_001" onclick="collectTrends(0, 349257, 3533, 387016);"><span class="icons icons_collect">&nbsp;</span><label>0</label></a>
																</li>
							</ul>
							
						</footer>
					</article>
				</div>

				<div>
									<ul id="list_comment" class="list_comment">
										
						<li>
							<dl class="tbox">
								<dd>
									<span class="head_img">
																			<img src="commentlist_files/2.png" onerror="this.src='http://stc.weimob.com/img/sns/2.png';">
																		</span>
								</dd>
								<dd>
																<h7>游客 回复 游客</h7>
																<p>高端机不错<span class="icons icons_del" onclick="delComment(this,349257, 3533,4570, 387016, 387016);">&nbsp;</span></p>
									<time>
									2014-10-26 22:39:44      <span>赞 <label id="praise_4570">0</label></span>
									</time>
								</dd>
								<dd>
									<span class="icons icons_op" onclick="showOperate(true, this, event);">
										<a href="http://349257.m.weimob.com/snsmobile/commentview?sid=349257&amp;tid=3533&amp;cid=4570&amp;uid=387016&amp;exa_praise=0&amp;ruid=387016&amp;t=1" class="btn">回复</a>
																		    <a href="javascript:commentPraise(0,349257,3533,4570,387016);" class="btn" id="cid_4570">赞</a>
										
										<a href="javascript:showOperate(false);" class="btn calcel">取消</a>
									</span>
								</dd>
							</dl>
						</li>
										
						<li>
							<dl class="tbox">
								<dd>
									<span class="head_img">
																			<img src="commentlist_files/2.png" onerror="this.src='http://stc.weimob.com/img/sns/2.png';">
																		</span>
								</dd>
								<dd>
																<h7>游客 回复 游客</h7>
																<p>联想的也不错<span class="icons icons_del" onclick="delComment(this,349257, 3533,4569, 387016, 387016);">&nbsp;</span></p>
									<time>
									2014-10-26 22:38:54      <span>赞 <label id="praise_4569">0</label></span>
									</time>
								</dd>
								<dd>
									<span class="icons icons_op" onclick="showOperate(true, this, event);">
										<a href="http://349257.m.weimob.com/snsmobile/commentview?sid=349257&amp;tid=3533&amp;cid=4569&amp;uid=387016&amp;exa_praise=0&amp;ruid=387016&amp;t=1" class="btn">回复</a>
																		    <a href="javascript:commentPraise(0,349257,3533,4569,387016);" class="btn" id="cid_4569">赞</a>
										
										<a href="javascript:showOperate(false);" class="btn calcel">取消</a>
									</span>
								</dd>
							</dl>
						</li>
										
						<li>
							<dl class="tbox">
								<dd>
									<span class="head_img">
																		    <img src="commentlist_files/2.png" onerror="this.src='http://stc.weimob.com/img/sns/2.png';">
																		</span>
								</dd>
								<dd>
																<h7>游客</h7>
																<p>我觉得苹果的，华硕的不错<span class="icons icons_del" onclick="delComment(this,349257, 3533,4568, 387016, 387016);">&nbsp;</span></p>
									<time>
									2014-10-26 22:23:34      <span>赞 <label id="praise_4568">0</label></span>
									</time>
								</dd>
								<dd>
									<span class="icons icons_op" onclick="showOperate(true, this, event);">
										<a href="http://349257.m.weimob.com/snsmobile/commentview?sid=349257&amp;tid=3533&amp;cid=4568&amp;uid=387016&amp;exa_praise=0&amp;ruid=387016&amp;t=1" class="btn">回复</a>
																		    <a href="javascript:commentPraise(0,349257,3533,4568,387016);" class="btn" id="cid_4568">赞</a>
										
										<a href="javascript:showOperate(false);" class="btn calcel">取消</a>
									</span>
								</dd>
							</dl>
						</li>
									    					</ul>
			    				</div>
			</div>
			<footer>
				<section class="nav_footer">
					<ul class="box">
						<li>
							<a href="http://349257.m.weimob.com/snsmobile?v=c870a293a4a5578b466f623abc1648e2&amp;pid=349257&amp;wechat_id=okthVt76nHZp7-wt88ED7szslHvw">
								<span class="icons_back">&nbsp;</span>
								<label>返回</label>
							</a>
						</li>
						<li>
							<a href="http://349257.m.weimob.com/snsmobile/commentview?sid=349257&amp;tid=3533&amp;uid=387016&amp;ruid=387016&amp;exa_praise=0&amp;t=0">
								<span class="icons_comment">&nbsp;</span>
								<label>评论</label>
							</a>
						</li>
					    <li>
													<a href="javascript:;" class="on" id="praise_002" onclick="praiseTrends(1, 349257, 3533, 387016);">
							
								<span class="icons_like">&nbsp;</span>
								<label>赞</label>
							</a>
						</li>
						<li>
												    <a href="javascript:;" id="collect_002" onclick="collectTrends(0, 349257, 3533, 387016);">
					    								<span class="icons_love">&nbsp;</span>
								<label>喜欢</label>
							</a>
						</li>
					</ul>
				</section>
			</footer>
		</div>
	
	<section id="pop_operate" class="pop_operate">
		<div class="pop_container" onclick="showOperate(false);">
			<a href="javascript:;" class="btn">回复</a>
			<a href="javascript:;" class="btn">赞</a>
			<a href="javascript:showOperate(false);" class="btn calcel">取消</a>
		</div>
		<div class="pop_masker"></div>
	</section>
	<script>
    	document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
        WeixinJSBridge.call('showOptionMenu');
    });
	</script>
</body></html>